<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>主题设置</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no"/>
    <meta name="renderer" content="webkit"/>
    <meta name="force-rendering" content="webkit"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <link rel="stylesheet" href="/static/public/libs/layui-v2.5.6/layui/css/layui.css">
    <link href="/static/public/libs/font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet"/>
    <link href="/static/admin/static/css/main.css?v=#(version)" rel="stylesheet"/>
    <link href="/static/themes/perfree/static/css/setting.css?v=#(version)" rel="stylesheet">
</head>
<body class="layui-layout-body">
<div class="p-container">
    <div class="layui-card">
        <div class="layui-card-body">
            <form class="layui-form" action="">
                <div class="layui-form-item">
                    <label class="layui-form-label">网站右侧名称</label>
                    <div class="layui-input-block">
                        <input type="text" value="#option('PERFREE_WEB_NAME')" name="PERFREE_WEB_NAME" placeholder="请输入网站名称" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">网站右侧logo</label>
                    <div class="layui-input-block">
                        <div class="p-upload-box" id="PERFREE_WEB_LOGO">
                            <input type="hidden" value="#option('PERFREE_WEB_LOGO')" name="PERFREE_WEB_LOGO">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">网站主题色</label>
                    <div class="layui-input-block">
                        <input type="text" value="#option('PERFREE_PRIMARY_COLOR')" name="PERFREE_PRIMARY_COLOR" placeholder="请输入网站主题色代码,如#409eff" autocomplete="off" class="layui-input">
                    </div>
                </div>


                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="optionForm">保存设置</button>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>

<script src="/static/public/libs/jquery/jquery-3.5.1.min.js"></script>
<script src="/static/public/libs/layui-v2.5.6/layui/layui.js"></script>
<script src="/static/public/js/main.js?v=#(version)"></script>
<script>
    let layer,form;
    layui.use(['layer','form'], function() {
        layer = layui.layer;
        form = layui.form;
        form.on('submit(optionForm)', function(data){
            $.ajax({
                type: "POST",
                url: "/admin/setting/save",
                contentType:"application/json",
                data: JSON.stringify(data.field),
                success:function(d){
                    if (d.code === 200){
                        parent.layer.msg("保存成功", {icon: 1})
                    } else {
                        layer.msg(d.msg, {icon: 2});
                    }
                },
                error: function (data) {
                    layer.msg("保存失败", {icon: 2});
                }
            });
            return false;
        });
    });
</script>
</body>
</html>